<template>
  <div class="">
    <el-button v-if="copyConfig.show" type="text" @click="handleCopy(params.data)">{{ copyConfig.text }}</el-button>
    <el-button v-if="updateConfig.show" type="text" @click="handleEdit(params.data)">{{ updateConfig.text }}</el-button>
    <el-button v-if="deleteConfig.show" type="text" @click="handleDelete(params.data)">{{ deleteConfig.text }}</el-button>
  </div>
</template>

<script>
export default {
  props: {
    params: {
      type: Object,
      required: true
    },
    copyConfig: {
      type: Object,
      default: () => ({
        text: 'copy',
        show: true
      })
    },
    updateConfig: {
      type: Object,
      default: () => ({
        text: 'edit',
        show: true
      })
    },
    deleteConfig: {
      type: Object,
      default: () => ({
        text: 'delete',
        show: true
      })
    }
  },
  methods: {
    // 复制
    handleCopy(row) {
      this.$emit('copy', row)
    },
    // 编辑
    handleEdit(row) {
      this.$emit('edit', row)
    },
    // 删除
    handleDelete(row) {
      this.$emit('delete', row)
    }
  }
}
</script>

<style scoped></style>
